﻿@model EntriesViewModel

@{ this.Layout = "~/Views/Shared/Layout.cshtml"; }

@this.Html.RenderMessage()

<div class="sitePath">
	<a title="@this.Model.PageDescription" href="@this.Url.Action("List", new { pageNumber = 1, viewType = this.Model.ViewType, tag = (string)null })">@this.Model.PageName</a>
	
	@if (this.Model.IsLogged)
	{	 
		<a class="newEntryButton" title="@Resources.AddNewEntry" href="@this.Url.Action("New", new { viewType = this.Model.ViewType })">@Resources.NewEntry</a>
	}
</div>

@foreach (EntryViewModel entryViewModel in this.Model)
{
	@this.Html.Partial("ViewEntry", entryViewModel);
}

<div class="pager">
	
	@switch(this.Model.Paging.FilterConfig.FilterMode)
	{
		case FilterMode.Tag:
			@this.Html.RenderPageLinks(this.Model.Paging, (viewType, pageNumber, filter) => Url.Action("List", "Entries", new { viewType = viewType, pageNumber = pageNumber, tag = filter.Tag }))
			break;
		case FilterMode.Search:
			@this.Html.RenderPageLinks(this.Model.Paging, (viewType, pageNumber, filter) => Url.Action("SearchList", "Entries", new { viewType = viewType, pageNumber = pageNumber, searchValue = filter.SearchValue }))
			break;
		case FilterMode.Archive:
			@this.Html.RenderPageLinks(this.Model.Paging, (viewType, pageNumber, filter) => Url.Action("Archive", "Entries", new { viewType = viewType, pageNumber = pageNumber, month = filter.Month, year = filter.Year }))
			break;
	}

</div>